package com.xm.xmapp.adapter;

import java.util.ArrayList;

import android.app.Activity;
import android.content.Intent;
import android.view.View;
import android.view.View.OnClickListener;

import com.xm.xmapp.InvoiceDetailsActivity;
import com.xm.xmapp.R;
import com.xm.xmapp.app.MyAppcation;
import com.xm.xmapp.base.MyBaseAdapter;
import com.xm.xmapp.base.ViewHolder;
import com.xm.xmapp.response.bean.Get_user_invoice_record_listResponse;
import com.xm.xmapp.response.bean.Get_user_invoice_record_listResponse.T;
import com.xm.xmapp.tools.StringTools;

public class InvoiceListAdapter extends MyBaseAdapter<Get_user_invoice_record_listResponse.T>{

	public InvoiceListAdapter(ArrayList<T> list, Activity activity, int layoutId) {
		super(list, activity, layoutId);
		
	}

	@Override
	public void setValues(ViewHolder holder, final T t, int position) {
		
		holder.setText(R.id.money, t.invoice_money).setText(R.id.riqi, StringTools.getTime(t.submit_time * 1000, "yyyy-MM-dd HH:mm:ss"));
		
		holder.getConvertView().setOnClickListener(new OnClickListener() {
			
			@Override
			public void onClick(View v) {
				Intent intent = new Intent(MyAppcation.getMyAppcation(), InvoiceDetailsActivity.class);
				intent.putExtra("bean", t);
				intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
				activity.startActivity(intent);
			}
		});
		
		
		
	}

}
